package com.example.zdxk.mapper.primary;

import com.example.zdxk.entity.Setting;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface SettingMapper {

    @Select("SELECT * FROM DC_SETTING WHERE imei = #{Imei} AND confirm = 'no' ORDER BY submitTime LIMIT 0,1")
    List<Setting> getSettingByImei(String Imei);

    @Select("SELECT * FROM DC_SETTING WHERE sid = #{sid}")
    Setting getSettingBySid(Integer sid);

    @Select("SELECT * FROM DC_SETTING")
    public List<Setting> getsettingList(String imei, int page, int limit);




   @Insert("insert into DC_SETTING(imei, setting,submitTime,confirm, meg_id) values(#{imei}, #{setting}, #{submitTime}, #{confirm},#{meg_id})")
    public int add(Setting xixunSetting);

   //页面上改
   @Update("UPDATE DC_SETTING SET submitTime = #{submitTime} , setting = #{setting}, confirm=#{confirm} WHERE sid = #{sid}")
   public int update(Setting xixunSetting);

   //提交终端后
    @Update("UPDATE DC_SETTING SET confirm=#{confirm}, confirmTime=#{confirmTime} WHERE sid = #{sid}")
   int updateAfterConfirm(Setting xixunSetting);

   @Delete("DELETE FROM DC_SETTING WHERE sid = #{sid} ")
    public int delete(Integer sid);
    @Select("SELECT * FROM DC_SETTING WHERE term = #{term}")
    Setting getSettingByTerm(String term);




}